home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
bisonpcb.zip
/
TGRAM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1987-09-18
|
11KB
|
477 lines
/* A Bison parser, made from tgram.y */
#define TERM 258
#define TTERM 3
#define UMINUS 259
#define TUMINUS 11
#include "tgram.att"
#include <stdio.h>
#define YYFINAL 20
#define YYFLAG -32768
#define YYNTBASE 12
#define YYTRANSLATE(x) (yytranslate[x])
static char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 4,
5, 9, 7, 2, 8, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
6, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 10, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 3, 11
};
static short yyprhs[] = { 0,
0, 4, 8, 12, 16, 17, 22, 25, 27
};
static short yyrhs[] = { 12,
7, 12, 0, 12, 8, 12, 0, 12, 9, 12,
0, 12, 10, 12, 0, 0, 4, 13, 12, 5,
0, 8, 12, 0, 3, 0, 12, 6, 12, 0
};
static short yystos[] = { 0,
3, 4, 8, 12, 13, 12, 6, 7, 8, 9,
10, 12, 12, 12, 12, 12, 12, 5, 0, 0
};
static short yyrline[] = { 0,
14, 15, 16, 17, 18, 18, 19, 20, 21
};
static char * yytname[] = { 0,
"error","$illegal.","TERM","'('","')'","'='","'+'","'-'","'*'","'\\\\'",
"UMINUS","expr"
};
static short yyr1[] = { 0,
12, 12, 12, 12, 13, 12, 12, 12, 12
};
static short yyr2[] = { 0,
3, 3, 3, 3, 0, 4, 2, 1, 3
};
static short yydefact[] = { 0,
8, 5, 0, 0, 0, 7, 0, 0, 0, 0,
0, 0, 9, 1, 2, 3, 4, 6, 0, 0
};
static short yydefgoto[] = { 4,
5
};
static short yypact[] = { 23,
-32768,-32768, 23, 0, 23,-32768, 23, 23, 23, 23,
23, 15, -5, 19,-32768,-32768,-32768,-32768, 12,-32768
};
static short yypgoto[] = { 8,
-32768
};
#define YYLAST 31
static short yytable[] = { 19,
7, 8, 9, 10, 11, 7, 8, 9, 10, 11,
6, 20, 12, 0, 13, 14, 15, 16, 17, 18,
7, 8, 9, 10, 11, 1, 2, 10, 11, 0,
3
};
static short yycheck[] = { 0,
6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
3, 0, 5, -1, 7, 8, 9, 10, 11, 5,
6, 7, 8, 9, 10, 3, 4, 9, 10, -1,
8
};
#define YYPURE 1
extern int timeclock;
int yyerror; /* Yyerror and yycost are set by guards. */
int yycost; /* If yyerror is set to a nonzero value by a */
/* guard, the reduction with which the guard */
/* is associated is not performed, and the */
/* error recovery mechanism is invoked. */
/* Yycost indicates the cost of performing */
/* the reduction given the attributes of the */
/* symbols. */
#define YYACCEPT return (0)
#define YYABORT return (1)
/* YYMAXDEPTH indicates the size of the parser's state and value */
/* stacks. */
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 500
#endif
/* YYMAXRULES must be at least as large as the number of rules that */
/* could be placed in the rule queue. That number could be determined */
/* from the grammar and the size of the stack, but, as yet, it is not. */
#ifndef YYMAXRULES
#define YYMAXRULES 100
#endif
#ifndef YYMAXBACKUP
#define YYMAXBACKUP 100
#endif
short yyss[YYMAXDEPTH]; /* the state stack */
YYSTYPE yyvs[YYMAXDEPTH]; /* the semantic value stack */
YYLTYPE yyls[YYMAXDEPTH]; /* the location stack */
short yyrq[YYMAXRULES]; /* the rule queue */
int yychar; /* the lookahead symbol */
YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
YYSTYPE yytval; /* the semantic value for the state */
/* at the top of the state stack. */
YYSTYPE yyval; /* the variable used to return */
/* semantic values from the action */
/* routines */
YYLTYPE yylloc; /* location data for the lookahead */
/* symbol */
YYLTYPE yytloc; /* location data for the state at the */
/* top of the state stack */
int yynunlexed;
short yyunchar[YYMAXBACKUP];
YYSTYPE yyunval[YYMAXBACKUP];
YYLTYPE yyunloc[YYMAXBACKUP];
short *yygssp; /* a pointer to the top of the state */
/* stack; only set during error */
/* recovery. */
YYSTYPE *yygvsp; /* a pointer to the top of the value */
/* stack; only set during error */
/* recovery. */
YYLTYPE *yyglsp; /* a pointer to the top of the */
/* location stack; only set during */
/* error recovery. */
/* Yyget is an interface between the parser and the lexical analyzer. */
/* It is costly to provide such an interface, but it avoids requiring */
/* the lexical analyzer to be able to back up the scan. */
yyget()
{
if (yynunlexed > 0)
{
yynunlexed--;
yychar = yyunchar[yynunlexed];
yylval = yyunval[yynunlexed];
yylloc = yyunloc[yynunlexed];
}
else if (yychar <= 0)
yychar = 0;
else
{
yychar = yylex();
if (yychar < 0)
yychar = 0;
else yychar = YYTRANSLATE(yychar);
}
}
yyunlex(chr, val, loc)
int chr;
YYSTYPE val;
YYLTYPE loc;
{
yyunchar[yynunlexed] = chr;
yyunval[yynunlexed] = val;
yyunloc[yynunlexed] = loc;
yynunlexed++;
}
yyrestore(first, last)
register short *first;
register short *last;
{
register short *ssp;
register short *rp;
register int symbol;
register int state;
register int tvalsaved;
ssp = yygssp;
yyunlex(yychar, yylval, yylloc);
tvalsaved = 0;
while (first != last)
{
symbol = yystos[*ssp];
if (symbol < YYNTBASE)
{
yyunlex(symbol, yytval, yytloc);
tvalsaved = 1;
ssp--;
}
ssp--;
if (first == yyrq)
first = yyrq + YYMAXRULES;
first--;
for (rp = yyrhs + yyprhs[*first]; symbol = *rp; rp++)
{
if (symbol < YYNTBASE)
state = yytable[yypact[*ssp] + symbol];
else
{
state = yypgoto[symbol - YYNTBASE] + *ssp;
if (state >= 0 && state <= YYLAST && yycheck[state] == *ssp)
state = yytable[state];
else
state = yydefgoto[symbol - YYNTBASE];
}
*++ssp = state;
}
}
if ( ! tvalsaved && ssp > yyss)
{
yy